package com.tledu.zyf.servlet.group;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tledu.zyf.util.AjaxObj;
import com.tledu.zyf.util.ObjectFactory;

@WebServlet("/group/verifyGroupname")
public class GroupVerifyGroupname extends HttpServlet {
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String groupname = req.getParameter("groupname");
		boolean flag = ObjectFactory.getGroupService().verifyGroupname(groupname);
		if (flag) {
			resp.getWriter().println(new AjaxObj(0, "部门名已存在").toJSON());
		} else {
			resp.getWriter().println(new AjaxObj(1, "部门名可以使用").toJSON());
		}
	}
}
